﻿var Common = new 
function () {
    var getOs = function () {
        var OsObject = "";
        if (navigator.userAgent.indexOf("MSIE") > 0) {
            return "IE";
        }
        if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
            return "FF";
        }
        if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
            return "Safari";
        }
        if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
            return "Camino";
        }
        if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) {
            return "Gecko";
        }
    };
    this.setlocatePoint = function (id) {

        var aCtrl = document.getElementById(id);
  
        if (getOs() == "FF") {
            if (aCtrl.setSelectionRange) {
                setTimeout(function () {
                    aCtrl.setSelectionRange(aCtrl.value.length, aCtrl.value.length);  //将光标定位在textarea的开头，需要定位到其他位置的请自行修改
                    aCtrl.focus();
                }, 0);
            }
        } else if (aCtrl.createTextRange) {
            var tempText = aCtrl.createTextRange();
            tempText.moveStart('character', aCtrl.value.length);
            tempText.collapse(true);
            tempText.select();

        };  
         
    }
};